package cn.edu.scau.cmi.xuminbang.client.classicsDesignPattern;



import java.util.Scanner;

import cn.edu.scau.cmi.xuminbang.abstractFactory.AbstractFactory;
import cn.edu.scau.cmi.xuminbang.abstractFactory.AonongFactory;
import cn.edu.scau.cmi.xuminbang.abstractFactory.TianbangFactory;
import cn.edu.scau.cmi.xuminbang.abstractFactory.WensFactory;
import cn.edu.scau.cmi.xuminbang.simpleFactoryMethon.Meat;

public class AbstractFactoryClient {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println("Please select which brand you want to buy: Wens, Tianbang or Aonong???");
		Scanner scanner = new Scanner(System.in);
		String brand = scanner.nextLine();
		//scanner.close();
		AbstractFactory factory = null; 
		switch(brand){
		case "Wens": factory=new WensFactory();break;
		case "Tianbang": factory=new TianbangFactory();break;
		case "Aonong": factory=new AonongFactory();break;
		default:System.out.println("sorry, your input is not correct");
		
		}
		System.out.println("Please select which meat you want to buy: pork, beef or chicken???");
		String meatName = null;
		meatName = scanner.nextLine();
		scanner.close();
		Meat meatInstance = null;
		switch(meatName){
		case "pork": meatInstance = factory.createPork();break;		
		case "beef": meatInstance = factory.createBeef();break;	
		case "chicken": meatInstance = factory.createChicken();break;	
		default:System.out.println("sorry, your input is not correct");
		}  
		if(meatInstance!=null) {
			meatInstance.cook();
		}

	}

}
